import {FC,useEffect,useState} from 'react'
import { Table,Pagination } from "antd";
import { getTestList } from './service'
import useTable from '@/hooks/useTable'
const Index:FC = () => {
    const {
        getTable,
        loading,
        columnList,
        data,
        total,
        current,
        pageSize,
        setCurrent,
        setPageSize
    } = useTable(getTestList)
    useEffect(() => {
        getTable()
    },[])
    return (
    <div className='flex flex-col w-full h-full' style={{width:'100%',height:'100%'}}>
        <Table loading={loading} className='h-[90%] overflow-scroll' sticky={true} dataSource={data}  rowKey={item => item.id}  columns={columnList} pagination={false}/>
        <Pagination className='h-[10%] ml-auto mt-[20px] mr-[20px]' defaultCurrent={1} current={current} total={total}  onChange={setCurrent} pageSize={pageSize} onShowSizeChange={setPageSize}  showSizeChanger showQuickJumper showTotal={(total) => `总共${total}项`}/>
    </div>)
}
export default Index